<template>
  <div class="nav">
      <button class="button" @click="list" >
        <span class="glyphicon glyphicon-th-list" v-if="displayList == 'none'"></span>
        <span class="glyphicon glyphicon-remove" v-else></span>
      </button>
      <div class="list" :style="{display: displayList }">
        <ul class="content">
          
            <li @click="gotoDetail(0)">
            <span>素材</span>
            <span class="glyphicon glyphicon-menu-right" aria-hidden="true"></span>
            <div class="icon">
              <span class="glyphicon glyphicon-film" aria-hidden="true"></span>
            </div>
          </li>
        
          
          <li @click="gotoDetail(1)">
             <span>记录</span>
             <span class="glyphicon glyphicon-menu-right" aria-hidden="true"></span>
             <div class="icon">
              <span class="glyphicon glyphicon-tag" aria-hidden="true"></span>
             </div>

          </li>
          <li @click="gotoDetail(2)">
            <span>博客</span>
            <span class="glyphicon glyphicon-menu-right" aria-hidden="true"></span>
            <div class="icon">
              <span class="glyphicon glyphicon-folder-open" aria-hidden="true"></span>
            </div>
          </li>
          <li @click="gotoDetail(3)">
             <span>关于我</span>
             <span class="glyphicon glyphicon-menu-right" aria-hidden="true"></span>
             <div class="icon">
              <span class="glyphicon glyphicon-user" aria-hidden="true"></span>
             </div>
          </li>
        </ul>
      </div>
  </div>
</template>

<script>
export default {
  name:'navComponent',
 data() {
   return {
     displayList:'none',
     urlList:['/blog/source','/blog/record','/blog','about']
   }
 },
 mounted() {
   //this.move()
 },
 methods: {
   list() {
     //this.$router.push('index')
     if(this.displayList === 'none') {
        this.displayList = 'block'
     }else {
       this.displayList = 'none'
     }

   },
   move(e) {
    let x = (e.pageX * -1 / 5), y = (e.pageY * -1 / 5);
    // $(this).css('background-position', x + 'px ' + y + 'px');
    this.$refs.img.style.backgroundPosition = `${x}px ${y}px`
   },
   gotoDetail(index) {
     this.$router.push(`${this.urlList[index]}`)
   }
 }
}
</script>

<style lang="less" scoped>


.nav {
  position: relative;
  height: 100%;
   width: 100%;
  // background-color: aqua;
}
.button {
  outline: none;
  outline-offset:0;
  position: absolute;
  top: 0%;
  left: 93%;
  border: none;
  width: 30px;
  height: 30px;
  transform: translateX(-50%);
  border-radius: 10px;
  background-color: rgb(252, 252, 252);
  opacity: 0.7;
  display: flex;
  justify-content: center;
  align-items: center;
  .glyphicon {
  font-size: 15px;
  font-weight: 100;
  color: rgb(236, 145, 59);
  opacity: .6;
}
}

.p {
  position: absolute;
  font-size: 30px;
  top: 7%;
  left: 52%;
  color: rgb(230, 245, 175);
}
.list {
  position: absolute;
  z-index: 2;
  top: 10%;
  right:10%;
  height: 300px;
  width: 300px;
  border-radius: 5px;
  background-color: white;
  box-shadow: 0px 0px 5px 5px #b4a8a8;
  text-shadow: 5px 5px 5px #b60802;
  .content {
    padding: 0;
    width: 300px;
    color: black;
  text-decoration: none;
   li {
     height: 30px;
     line-height: 40px;
     margin: 30px;
     list-style: none;
     font-family: Cambria, Cochin, Georgia, Times, 'Times New Roman', serif;
     font-size: 15px;
     text-align: left;
     cursor: pointer;
     .glyphicon {
       color: rgb(5, 0, 0);
       margin: -2px -2px -2px 2px;
       font-size: 10px;
     }
     .icon {
       display: inline-block;
       margin-left: 150px;
       .glyphicon {
         font-size: 20px;
       }
     }
   }
  }
}
</style>